
$(function() {
	$('#left').transfer({
		to: '#right',
		searchId: '#search',
		dblClick: true,
		searchText: '{count} options matching {keyword}',
		searchTextId: '#searchText',
		addId: '#addT',
		removeId: '#removeT', 
		addAllId: '#addAllT', 
		removeAllId: '#removeAllT',
		tClass: 'added'
	});
	
	Tip.supplier();
	
	$("input[id='out']:visible").blur(function() {
		var a = $(this).val();
		// alert(a);
		// _in_item(a);
		
		if (a == null || a == '') {
			return;
		}
		
		var body = { };
		body.id = a;
		$.getJSON('finance.php?do=OutItem.ajax_list', body, function(json) {
			// alert($.toJSON(json));
			
			$select = $("#left");		
			$select.empty();			
			$.each(json, function(k, v) {
				var id = '';
				var s = '';
				if (v.in_item == null || v.in_item == '' || v.in_item == 0) {
					id = v.emp + "_" + v.id;
					s = v.id + "/" + v.emp_t + "/" + v.out_x.name + v.name + "/" + v.currency + "/" + v.total;	
				} else {
					id = '';
					s = "已做成本/" + v.id + "/" + v.emp_t +"/" + v.out_x.name + v.name + "/" + v.currency + "/" + v.total;
				}
		    	var item = new Option(s, id);
		    	$select[0].options.add(item);
		    });
		});
	});

});